package com.bee.common.core.jsonview;

import com.bee.common.core.jsonview.JsonViews.BaseView;

public class DataWithView implements DataView {

	private  Object data;
	private  Class<? extends BaseView> view;
	
	public DataWithView(Object data, Class<? extends BaseView> view) {
		super();
		this.data = data;
		this.view = view;
	}

	public DataWithView(Class<? extends BaseView> view) {
		this.view = view;
	}

	public DataWithView(String view) throws ClassNotFoundException {
		this.view= (Class<? extends BaseView>) Class.forName("com.bee.common.core.jsonview.JsonViews$"+view);
	}

	@Override
	public boolean hasView() {
		return true;
	}
	public Object getData() {
		return data;
	}
	public Class<? extends BaseView> getView() {
		return view;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public void setView(Class<? extends BaseView> view) {
		this.view = view;
	}
}
